package org.noka.mservice.base;

import java.io.Serializable;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;

public class NokaServletSession extends HashMap<String,Object> implements Serializable{
	private static final long serialVersionUID = 9136557027311507438L;
	private static final String AttributeNames ="AttributeNames";
	private static final String sessionid ="sessionid";
	
	public NokaServletSession(){}
	public NokaServletSession(Map<String,Object> m){
		super(m);
	}
	public NokaServletSession(String key, Object value){
		put(key, value);
	}
	
	public Object getAttribute(String name){
		return get(name);
	}
	public Enumeration<?> getAttributeNames(){
		if(get(AttributeNames) instanceof Enumeration){
			return (Enumeration<?>)get(AttributeNames);
		}
		return null;
	}
	public String getId(){
		if(get(sessionid) instanceof String){
			return (String)get(sessionid);
		}
		return null;
	}
	
	public void setAttribute(String name,Object value){
		put(name, value);
	}
	public void getAttributeNames(Enumeration<?> value){
		put(AttributeNames,value);
	}
	public void setId(String value){
		put(sessionid, value);
	}
}
